<#escape x as x?html>
<div class="bjui-pageContent">
	<form action="${ctx}/system/user/edit" class="pageForm" data-toggle="validate" data-reload-navtab="false" data-callback="editCallback">
		<ul class="nav nav-tabs" role="tablist">
		    <li class="active"><a href="#userInfo" role="tab" data-toggle="tab">基本信息</a></li>
		    <li><a href="#userOrg" role="tab" data-toggle="tab">授权组织</a></li>
		    <li><a href="#userRole" role="tab" data-toggle="tab">用户角色</a></li>
		</ul>
		<div class="tab-content">
			<div class="tab-pane fade active in" id="userInfo">
		    	<input type="hidden" name="userId" value="${user.userId}">
		        <table class="table table-condensed table-hover">
		            <tbody>
		            <tr>
		                <td>
		                    <label for="account" class="control-label x90">账号：</label>
		                    <input type="text" name="account" id="account" value="${user.account}" data-rule="required"
		                           size="20" readonly="readonly">
		                </td>
		            </tr>
		            <tr>
		                <td>
		                    <label for="username" class="control-label x90">姓名：</label>
		                    <input type="text" name="username" id="username" value="${user.username}" data-rule="required"
		                           size="20">
		                </td>
		            </tr>
		            <tr>
		                <td>
		                    <label for="email" class="control-label x90">邮箱：</label>
		                    <input type="text" name="email" id="email" value="${user.email}" data-rule="required,email" size="20">
		                </td>
		            </tr>
		            <tr>
		                <td>
		                    <label for="phone" class="control-label x90">手机：</label>
		                    <input type="text" name="phone" id="phone" value="${user.phone}" data-rule="required,mobile" size="20">
		                </td>
		            </tr>
		            <tr>
		                <td>
		                    <label for="orgName" class="control-label x90">所属机构：</label>
		                    <input name="orgId" type="hidden" value="${user.orgId}">
		                    <input id="orgName" type="text" name="orgName" value="${orgName!}" data-rule="required" data-toggle="lookup" data-url="${ctx}/common/lookup/org"/>
		                </td>
		            </tr>
		            <tr>
		                <td>
		                    <label for="available" class="control-label x90">状态：</label>
		                     <@h.select name="available" list=fn.getDicValue('AVAILABLE_STATUS') value=user.available/>
		                </td>
		            </tr>
		            </tbody>
		        </table>		    
			</div>
	    	<div class="tab-pane fade" id="userOrg">
	    	    <input type="hidden" name="orgIds" value="${orgIds!}" id="orgIds">
				<ul id="layout-tree-${right_divid}" data-on-check="nodeOnCheck${right_divid}"  data-check-enable="true"  class="ztree" data-toggle="ztree" data-expand-all="true">
			        <#list orgList as org> 
			           	<li data-checked="${org.checked?c}" data-id="${org.orgId}" data-pid="${org.parentId}">${org.orgName}</li>
			        </#list>              
			    </ul>
	    	</div>
	    	<div class="tab-pane fade" id="userRole">
			    <table data-toggle="tablefixed"  data-width="100%">
				    <thead>
				        <tr>
				        	<th width="26"><input type="checkbox" class="checkboxCtrl" data-group="roleIds" data-toggle="icheck"></th>
				            <th>角色名称</th>
				            <th>角色描述</th>
				            <th>状态</th>  
				        </tr>
				    </thead>
				    <tbody>
				        <#list roleList as role>
				            <tr>
				                <td><input type="checkbox" name="roleIds" <#if role.checked>checked="checked"</#if> data-toggle="icheck" value="${role.roleId}" ></td>
				                <td>${role.roleName}</td>
				                <td>${role.roleDesc}</td>
				                <td>${fn.getDicValue('AVAILABLE_STATUS',role.available)!}</td>
				            </tr>
				        </#list>
				    </tbody>
				</table>
	    	</div>
		</div>
	</form>
</div>
<div class="bjui-pageFooter">
    <ul>
        <li>
            <button type="button" class="btn-close">关闭</button>
        </li>
        <li>
            <button type="submit" class="btn-green">保存</button>
        </li>
    </ul>
</div>
<script type="text/javascript">
//选择事件
function nodeOnCheck${right_divid}(e, treeId, treeNode) {
    var zTree = $.fn.zTree.getZTreeObj(treeId);
    var nodes = zTree.getCheckedNodes(true);
    var ids = '';
    for (var i = 0; i < nodes.length; i++) {
        ids   += ','+ nodes[i].id;
    }
    if (ids.length > 0) {
        ids = ids.substr(1);
    }
   // alert(ids);
   $('#orgIds').val(ids);
  
    //var $from = $('#'+ treeId).data('fromObj')
    
    //if ($from && $from.length) $from.val(names)
}
</script>
</#escape>